package com.itheima.web.service.impl.sms;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.service.sms.IFlashPromotionService;
import com.itheima.vo.sms.FlashPromotion;
import com.itheima.web.mapper.sms.FlashPromotionMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 限时购表 服务实现类
 */
@DubboService
public class FlashPromotionServiceImpl extends ServiceImpl<FlashPromotionMapper, FlashPromotion> implements IFlashPromotionService {
    @Autowired
    private IFlashPromotionService flashPromotionService;
    @Override
    public Page<FlashPromotion> getPage(String keyword, Integer pageSize, Integer pageNum) {
        Page<FlashPromotion> pageInfo=new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<FlashPromotion> lqw=new LambdaQueryWrapper<>();
        lqw.like(keyword!=null&&keyword!="",FlashPromotion::getTitle,keyword);
        lqw.orderByAsc(FlashPromotion::getCreateTime);
        Page<FlashPromotion> page = flashPromotionService.page(pageInfo, lqw);
        return page;
    }
}
